/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.webanovare;

import com.webanovare.model.UserRegistry;
import com.webanovare.model.db.User;
import java.net.URI;
import java.net.URISyntaxException;
import javax.ejb.EJB;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
 *
 * @author expert
 */
@Path("user")
public class UserResource {
    @EJB
    UserRegistry reg;
    
    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public void add(@FormParam("userName") String name, @FormParam("password") String password) {
        reg.add(new User(name, password));
        try {
            Response.created(new URI("http://localhost:8080/ws_shop/rs/product"));
        } catch (URISyntaxException ex) {
            ex.printStackTrace();
        }
    }
}
